package com.jiancong.mapper;

import com.jiancong.domain.dto.RoleQueryCriteria;
import com.jiancong.domain.entity.Role;
import com.jiancong.domain.entity.UserRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 角色信息表(Role)表数据库访问层
 *
 * @author makejava
 * @since 2024-05-08 19:07:30
 */

public interface RoleMapper {
    List<String> selectRoleKeyByUserId(Long id);

    List<Role> listAllRoles();

    List<Role> selectRolesByCriteria(@Param("criteria") RoleQueryCriteria criteria);

    int updateStatus(@Param("role") Role role);

    boolean checkRoleNameExists(@Param("roleName") String roleName);

    int insertRole(@Param("role") Role role);

    Role getRoleById(@Param("id") Long id);

    int updateRole(@Param("role") Role role);

    int deleteRole(@Param("id") Long id);

    void insertUserRole(@Param("userRole") UserRole userRole);

    List<String> selectRoleIdsByUserId(@Param("id") Long id);

    List<Role> selectAllRoles();

    void deleteUserRolesByUserId(@Param("id") Long id);
}
